var api = require('../../utils/api.js')
var app = getApp()
Page({
    data: {
        passw:'',
        number:''
    },

    onShow() {


    },
    logins(){

        var account=this.data.number;
        var password=this.data.passw;

        api.post({
            url: 'user/login',
            data: {account:account,password:password},
            success: data => {
                console.log(data);
                wx.showToast({
                  title: data.msg,
                  icon:'none'
                })

                if(data.code==1){
                    
                    wx.setStorageSync('token', data.data.userinfo.token)
                    wx.setStorageSync('userinfo', data.data.userinfo)

                    wx.switchTab({
                      url: '/pages/index/index',
                    })
                }
            }
        });

    },
    getnumbner(ret){
        this.setData({
            number:ret.detail.value
        })
    },
    getpassw(ret){
        this.setData({
            passw:ret.detail.value
        })
    }
 
})
